#include<iostream>
using namespace std;
//返回倒数第K个节点
class ListNode
{
public:
    ListNode()
        :next(nullptr)
        , val(0)
    {}
    ListNode* next;
    int val;
};
class Solution 
{
public:
    int kthToLast(ListNode* head, int k) 
    {
        ListNode* cur = head;
        int count = 0;
        while (cur)
        {
            count++;
            cur = cur->next;
        }
        ListNode* pcur = head;
        for (int i = 1; i <= count - k; i++)
        {
            pcur = pcur->next;
        }
        return pcur->val;
    }
};
int main()
{
	return 0;
}